package com.example.shiwu.util;

import com.example.shiwu.db.model.BoxEight;
import com.example.shiwu.db.model.BoxFive;
import com.example.shiwu.db.model.BoxFour;
import com.example.shiwu.db.model.BoxNine;
import com.example.shiwu.db.model.BoxOne;
import com.example.shiwu.db.model.BoxSeven;
import com.example.shiwu.db.model.BoxSix;
import com.example.shiwu.db.model.BoxTen;
import com.example.shiwu.db.model.BoxThree;
import com.example.shiwu.db.model.BoxTwo;
import com.example.shiwu.service.BoxEightService;
import com.example.shiwu.service.BoxFiveService;
import com.example.shiwu.service.BoxFourService;
import com.example.shiwu.service.BoxNineService;
import com.example.shiwu.service.BoxOneService;
import com.example.shiwu.service.BoxSevenService;
import com.example.shiwu.service.BoxSixService;
import com.example.shiwu.service.BoxTenService;
import com.example.shiwu.service.BoxThreeService;
import com.example.shiwu.service.BoxTwoService;
import com.example.shiwu.update.bean.UpdateDb;

import java.util.List;

public class BoxUtil {

    public static void updateBox(String itemId){
        BoxOne box1 = new BoxOne(itemId.toString());
        BoxOneService boxOneService = new BoxOneService();
        List<BoxOne> boxOneList = boxOneService.getBoxOne(box1);
        Boolean bool1 = false;
        if(boxOneList.size()>0){
            bool1 = boxOneService.delete(box1);//先删表数据在删除文件
        }

        BoxTwo box2 = new BoxTwo(itemId.toString());
        BoxTwoService boxTwoService = new BoxTwoService();
        List<BoxTwo> boxTwoList = boxTwoService.getBoxTwo(box2);
        Boolean bool2 = false;
        if(boxTwoList.size()>0){
            bool2 = boxTwoService.delete(box2);
        }

        BoxThree box3 = new BoxThree(itemId.toString());
        BoxThreeService boxThreeService = new BoxThreeService();
        List<BoxThree> boxThreeList = boxThreeService.getBoxThree(box3);
        Boolean bool3 = false;
        if(boxThreeList.size()>0){
            bool3 = boxThreeService.delete(box3);
        }

        BoxFour box4 = new BoxFour(itemId.toString());
        BoxFourService boxFourService = new BoxFourService();
        List<BoxFour> boxFourList = boxFourService.getBoxFour(box4);
        Boolean bool4 = false;
        if(boxFourList.size()>0){
            bool4 = boxFourService.delete(box4);
        }

        BoxFive box5 = new BoxFive(itemId.toString());
        BoxFiveService boxFiveService = new BoxFiveService();
        List<BoxFive> boxFiveList = boxFiveService.getBoxFive(box5);
        Boolean bool5 = false;
        if(boxFiveList.size()>0){
            bool5 = boxFiveService.delete(box5);
        }

        BoxSix box6 = new BoxSix(itemId.toString());
        BoxSixService boxSixService = new BoxSixService();
        List<BoxSix> boxSixList = boxSixService.getBoxSix(box6);
        Boolean bool6 = false;
        if(boxSixList.size()>0){
            bool6 = boxSixService.delete(box6);
        }

        BoxSeven box7 = new BoxSeven(itemId.toString());
        BoxSevenService boxSevenService = new BoxSevenService();
        List<BoxSeven> boxSevenList = boxSevenService.getBoxSeven(box7);
        Boolean bool7 = false;
        if(boxSevenList.size()>0){
            bool7 = boxSevenService.delete(box7);
        }

        BoxEight box8 = new BoxEight(itemId.toString());
        BoxEightService boxEightService = new BoxEightService();
        List<BoxEight> boxEightList = boxEightService.getBoxEight(box8);
        Boolean bool8 = false;
        if(boxEightList.size()>0){
            bool8 = boxEightService.delete(box8);
        }

        BoxNine box9 = new BoxNine(itemId.toString());
        BoxNineService boxNineService = new BoxNineService();
        List<BoxNine> boxNineList = boxNineService.getBoxNine(box9);
        Boolean bool9 = false;
        if(boxNineList.size()>0){
            bool9 = boxNineService.delete(box9);
        }

        BoxTen box10 = new BoxTen(itemId.toString());
        BoxTenService boxTenService = new BoxTenService();
        List<BoxTen> boxTenList = boxTenService.getBoxTen(box10);
        Boolean bool10 = false;
        if(boxTenList.size()>0){
            bool10 = boxTenService.delete(box10);
        }
    }
}
